﻿using System;
using Loki.Utils;

namespace Loki.IoC
{
    public class UnityEngine : LokiObject, IIoCComponent
    {
        private const string DATA_CONTEXT = "DataContext";
        private const string MODEL_CONTEXT = "ModelContext";
        private const string UI_CONTEXT = "UIContext";

        private IObjectContext _UIContext;
        private IObjectContext _ModelContext;
        private IObjectContext _DataContext;

        public UnityEngine()
        {
            _UIContext = CreateContext(UI_CONTEXT);
            _DataContext = CreateContext(DATA_CONTEXT);
            _ModelContext = CreateContext(MODEL_CONTEXT);
        }

        public IObjectContext CreateContext(string P_ContextName)
        {
            return new UnityContext(P_ContextName);
        }

        public TModel GetApplicationModel<TModel>() where TModel : class, IObjectCreator
        {
            throw new NotImplementedException();

            //return _ModelContext.GetObject<ObjectModel>() as TModel;
        }

        public TModel GetDataModel<TModel>() where TModel : class, IObjectCreator
        {
            throw new NotImplementedException();

            //return _DataContext.GetObject<ObjectModel>() as TModel;
        }

        public TViewModel GetViewModel<TViewModel>() where TViewModel : class
        {
            throw new NotImplementedException();
            /*var L_SelectedVM = _UIContext.GetObject<TViewModel>();
            if (!L_SelectedVM.IsInitialized)
            {
                L_SelectedVM.Initialize();
            }

            return L_SelectedVM;*/
        }

        public void Initialize()
        {
            throw new NotImplementedException();
        }

        public IObjectContext DataContext
        {
            get { throw new NotImplementedException(); }
        }

        public IObjectContext ServicesContext
        {
            get { throw new NotImplementedException(); }
        }

        public IObjectContext UIContext
        {
            get { throw new NotImplementedException(); }
        }

        public IObjectContext DefaultContext
        {
            get { throw new NotImplementedException(); }
        }

        public System.Collections.Generic.IDictionary<string, IObjectContext> Contexts
        {
            get { throw new NotImplementedException(); }
        }

        public void DropContext(IObjectContext context)
        {
            throw new NotImplementedException();
        }
    }
}